package team.stride.tabs.records;

import java.util.ArrayList;

import team.stride.database.crud.results.ResultsItem;
import team.stride.database.crud.users.UsersItem;

public class ReportDistance
{
	private UsersItem user;
	private ArrayList<ResultsItem> results;

	public ReportDistance(UsersItem user, ArrayList<ResultsItem> rList)
	{
		this.user = user;
		this.results = rList;
	}

	public UsersItem getUser()
	{
		return user;
	}

	public void setUser(UsersItem user)
	{
		this.user = user;
	}

	public ArrayList<ResultsItem> getResults()
	{
		return results;
	}

	public void setResults(ArrayList<ResultsItem> results)
	{
		this.results = results;
	}

	public String toHTMLString()
	{
		String pl = "<h5>" + getFont1("Name: ") + getFont2(user.getName()) + "<br/>" + getFont1("Network: ")
				+ getFont2(user.getNetwork()) + "</h5><ul>";
		for (ResultsItem result : results)
		{
			pl += "<li><h6>" + getFont1("Userame: ") + result.getUsername() + "<br/>" + getFont1("Length: ")
					+ result.getLength() + " Km" + "<br/>" + getFont1("Time: ") + result.getTime() + " sec" + "<br/>"
					+ getFont1("Speed: ") + result.getTopSpeed() + " Km/h" + "<br/>" + getFont1("Date: ")
					+ result.getStringDate() + "</h6>";
		}
		return pl + "</ul>";
	}

	final static String getFont1(String text)
	{
		return "<font color='#777777'>" + text + "</font>";
	}

	final static String getFont2(String text)
	{
		return "<font color='#fe6700'>" + text + "</font>";
	}
}
